<?php
/**
 * Created by PhpStorm.
 * User: xk_96
 * Date: 2018/1/15
 * Time: 9:27
 */

namespace system\core;
defined('WWW_ROOT') or die(header("HTTP/1.1 404 Not Found"));

class Loader
{
    public function __construct()
    {
        spl_autoload_register(function ($class) {

            $classPath = BASE_ROOT . '/' . str_replace('\\','/',$class) . '.php';
            //echo $classPath.'<br>';
            if (is_file($classPath)) {
                include $classPath;
            } else {
                //throw new Exception("Unable to load controller $class");
            }
        });
    }
}